﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace backoffice
{
    public class backofficereport
    {
        private int _Id;
        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }

        private int _CustomerId;
        public int CustomerId
        {
            get { return _CustomerId; }
            set { _CustomerId = value; }
        }
            //private TimeSpan _Date;
            //public TimeSpan Date
            //{
            //    get { return _Date; }
            //    set { _Date = value; }
            //}
        private DateTime _Date;
        public DateTime Date
        {
            get { return _Date; }
            set { _Date = value; }
        }

        private TimeSpan _TimeUnit;
        public TimeSpan TimeUnit
        {
            get { return _TimeUnit; }
            set { _TimeUnit = value; }
        }

        private int _CustumersForEachCashBox;
        public int CustumersForEachCashBox
        {
            get { return _CustumersForEachCashBox; }
            set { _CustumersForEachCashBox = value; }
        }

        private int _CustomersTotal;
        public int CustomersTotal
        {
            get { return _CustomersTotal; }
            set { _CustomersTotal = value; }
        }

        public static backofficereport[] InitArray(int i)
        {
            backofficereport[] MemoryBuilder = new backofficereport[i];
            for (int counter = 0; counter < i; counter++)
            { 
                MemoryBuilder[counter]=new backofficereport();
            }
            return MemoryBuilder;
        }

        public void InsertDb()
        {
            SqlConnection con = new SqlConnection("Data Source=ARTHAS\\SQLEXPRESS;Initial Catalog=eschema;Persist Security Info=True;User ID=sa;Password=diablo");
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "USPInsertBackofficeReport";
            cmd.Parameters.Add("@CustomerId", SqlDbType.Int).Value = this.CustomerId;
            cmd.Parameters.Add("@DateReport", SqlDbType.Date).Value = this.Date;
            cmd.Parameters.Add("@TimeUnit", SqlDbType.Time).Value = this.TimeUnit;
            cmd.Parameters.Add("@CustumersForEachCashBox", SqlDbType.Int).Value = this.CustumersForEachCashBox;
            cmd.Parameters.Add("@CustomersTotal", SqlDbType.Int).Value = this.CustomersTotal;
            cmd.Connection = con;
            cmd.ExecuteNonQuery();
            con.Close();
           
        }
    }
}
